

********************
***** STUDY 1 ******
********************
use "survey2019_truncated.dta"
set scheme s1mono
ssc install sensemakr, all replace

********************
***** Figure 1 *****
********************

hist natpride if ethnicity>0, percent w(.5) disc title("How proud are you to be a Myanmar citizen?") ///
	xlabel(0 "Not proud at all" 1 "Not proud" 2 "Somewhat proud" 3 "Very proud") ///
	xtitle(" ")
graph bar (percent), over(relativepride)  title("National pride relative to ethnic pride")
gr combine "/Users/jjap/Dropbox/Minority-State Relations/BJPS/natpride.gph" ///
	"/Users/jjap/Dropbox/Minority-State Relations/BJPS/natidentification.gph"

******************
**** Table 1 *****
******************

** Values manually entered, truncated. 
sum natpride relativepride attachment pen_myanmar service service_pos electricity_tsp ///
	district govservice_location male age income urban edu_alt buddhist coethnic_CS ///
	conflict_ongoing  phluttaw incumbent if ethnicity>0


******************
**** Table 2 *****
******************
global CONTROLS electricity_tsp district govservice_location male age income_alt ///
	urban edu_alt buddhist coethnic_CS  conflict_ongoing  phluttaw incumbent_alt 
mata: mata clear

global DV natpride relativepride attachment pen_myanmar
mata: mata clear

est clear
foreach var in $DV {
reg `var' service $CONTROLS if ethnicity>0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using main.tex, replace b(%12.2f) se ///
	title(Service experience and ethnic minorities' attachment to the state)  ///
	star(* 0.10 ** 0.05 *** 0.01) 

** reported in text
*margins , at (  service = 1.720971) atmeans
*margins , at (  service = 2.157132) atmeans
*margins , at (  service_pos = (0(1)1) ) atmeans

********************
**** Table 3 *******
********************
** Tables manually combined. 

* Top panel: ongoing conflict
est clear
foreach var in $DV {
reg `var' service $CONTROLS if conflict_ongoing==1 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using conflict.tex, replace b(%12.2f) se ///
	title(Service experience, conflict status and nontitular minorities)  ///
	star(* 0.10 ** 0.05 *** 0.01) 

* Bottom panel: nontitular ethnic minorities

est clear
foreach var in $DV {
reg `var' service $CONTROLS if titular==0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using nontitularminorities.tex, replace b(%12.2f) se title(XXX)  ///
	star(* 0.10 ** 0.05 *** 0.01) 



**********************************
**** SUPPLEMENTARY MATERIAL ******
**********************************

** Table A1
*****************************
***** Correlations ********** 
*****************************
cor natpride relativepride attachment pen_myanmar

** Table A2
*************************************
***** Binary measure of IV ********** 
*************************************
est clear
foreach var in $DV {
reg `var' service_pos $CONTROLS if ethnicity>0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using main_binary.tex, replace b(%12.2f) se ///
	title(Results with a binary measure of service experience)  star(* 0.10 ** 0.05 *** 0.01) 

** Table A3
*****************************************
**** Service experience (e respect) *****
*****************************************

est clear
foreach var in $DV {
reg `var' service_erespect $CONTROLS if ethnicity>0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using main_altservice.tex, replace b(%12.2f) se ///
	title(Service experience and ethnic minorities' attachment to the state)  star(* 0.10 ** 0.05 *** 0.01) 

** Table A4
*************************************
**** Township fixed effect **********  
*************************************
est clear
foreach var in $DV {
reg `var' service $CONTROLS i.townshipid if ethnicity>0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using main_fe.tex, replace b(%12.2f) se title(Results with township FE)  star(* 0.10 ** 0.05 *** 0.01) 

** Table A5
********************
**** Logit ********* 
********************
global DVLOGIT natpride relativepride pen_myanmar
mata: mata clear

est clear
foreach var in $DVLOGIT {
ologit `var' service $CONTROLS if ethnicity>0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}


foreach var in $DVLOGIT {
ologit `var' service_pos $CONTROLS if ethnicity>0, cluster(locationid)
eststo est2_`var'
local estimates2 `estimates2' est2_`var'
}

esttab est_natpride est2_natpride est_relativepride est2_relativepride est_pen_myanmar ///
	est2_pen_myanmar using main_logit.tex, replace b(%12.2f) se ///
	title(Logistic regressions: Service experience and ethnic minorities' attachment to the state)  ///
	star(* 0.10 ** 0.05 *** 0.01) 

** Table A6
****************************************
****** Standarized cofficients *********  
****************************************

est clear
foreach var in $DV {
reg `var' service $CONTROLS if ethnicity>0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using main.tex, beta replace b(%12.2f) se ///
	title(Standardized beta coefficients)  star(* 0.10 ** 0.05 *** 0.01) 

** Table A7
****************************************
**** Alt. measure of power-sharing ***** 
****************************************

global CONTROLS_A electricity_tsp district govservice_location male age income_alt ///
	urban edu_alt buddhist coethnic_CS  conflict_ongoing  prescabinet incumbent_alt 
mata: mata clear


est clear
foreach var in $DV {
reg `var' service $CONTROLS_A if ethnicity>0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using main.tex, replace b(%12.2f) se ///
	title(Results with alt. measure of power-sharing - coethnic cabinet minister)  ///
	star(* 0.10 ** 0.05 *** 0.01) 

** Table A8
global CONTROLS_B electricity_tsp district govservice_location male age income_alt ///
	urban edu_alt buddhist coethnic_CS  conflict_ongoing  unionhluttaw incumbent_alt 
mata: mata clear


est clear
foreach var in $DV {
reg `var' service $CONTROLS_B if ethnicity>0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using main.tex, replace b(%12.2f) se ///
	title(Results with alt. measure of power-sharing - seat share in parliament)  ///
	star(* 0.10 ** 0.05 *** 0.01) 

** Table A9
****************************************
**** Alt. measure of coethnic CS present/Remote 
****************************************
global CONTROLS_C electricity_tsp district govservice_location male age income_alt ///
	urban edu_alt buddhist remote  conflict_ongoing  phluttaw incumbent_alt 
mata: mata clear


est clear
foreach var in $DV {
reg `var' service $CONTROLS_C if ethnicity>0 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using main-remote.tex, replace b(%12.2f) se ///
	title(Results with alt. measure of coethnic presence - remote)  star(* 0.10 ** 0.05 *** 0.01) 


** Table A10
****************************************
**** Conflict on-going
****************************************

est clear
foreach var in $DV {
reg `var' service $CONTROLS if conflict_ongoing==1 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using conflict.tex, replace b(%12.2f) se title(Subsample: Conflict on-going ) ///
	star(* 0.10 ** 0.05 *** 0.01) 


** Table A11
****************************************
**** Experiences of conflict casualty
****************************************
est clear
foreach var in $DV {
reg `var' service $CONTROLS if casualty==1 , cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using casualty.tex, replace b(%12.2f) se title(Subsample: Experienced conflict casualty )  star(* 0.10 ** 0.05 *** 0.01) 


** Table A12
****************************************
**** Non-titular ethnic minorities
****************************************
est clear
foreach var in $DV {
reg `var' service $CONTROLS if titular==0 & visit==1, cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}

esttab `estimates1' using nontitularminorities.tex, replace b(%12.2f) se title(Service experience and non-titular ethnic minorities)  star(* 0.10 ** 0.05 *** 0.01) 

** Figure A1 & A2
**************************
***** Selection Bias *****
**************************
center natpride relativepride attachment pen_myanmar buddhist visit if ethnicity>0, standardize prefix(std_)
global SELECTIONBIAS  std_natpride std_relativepride std_attachment std_pen_myanmar std_buddhist
mata: mata clear


est clear
foreach var in $SELECTIONBIAS {
logit visit `var' if ethnicity>0 
estimates store est_`var'
local estimates1 `estimates1' est_`var' 
}

*** plot manually edited
coefplot est_std_natpride est_std_relativepride est_std_attachment est_std_pen_myanmar est_std_buddhist, ///
	drop(_cons) xline(0.36 0 -0.36) msymbol(s) mfcolor(white)  xtitle("Equivalence Range (in standard deviations)")  ///
	levels(90) offset(0) legend(off) xsc(r(-0.5 (0.5) 0.5))
	
foreach var in $SELECTIONBIAS {
logit visit_gad `var' if ethnicity>0
estimates store gad_`var'
local estimates1 `estimates1' gad_`var'
}
	
*** plot manually edited
coefplot gad_std_natpride gad_std_relativepride gad_std_attachment gad_std_pen_myanmar gad_std_buddhist, ///
	drop(_cons) xline(0.36 0 -0.36) msymbol(s) mfcolor(white)   xtitle("Equivalence Range (in standard deviations)")   ///
	levels(90) offset(0) legend(off) legend(off) xsc(r(-0.5 (0.5) 0.5))
	

** Table A13
****************************************
******** Sensitivity analysis **********
****************************************
// Run sensitivity analysis, using buddhist as a benchmark covariate:


sensemakr natpride service $CONTROLS  if ethnicity>0 ,  treat(service) benchmark(buddhist) contourplot

sensemakr relativepride service $CONTROLS  if ethnicity>0 ,  treat(service) benchmark(buddhist) contourplot

sensemakr attachment service $CONTROLS  if ethnicity>0 ,  treat(service) benchmark(buddhist) contourplot

sensemakr pen_myanmar service $CONTROLS  if ethnicity>0 ,  treat(service) benchmark(buddhist) contourplot

** Table A14
********************************
**** Bureaucratic agency *******
********************************
reg service state male age urban edu_alt income_alt wunhtanfam electricity_tsp minority , cluster(locationid)
eststo conflict1
reg service state male age urban edu_alt income_alt wunhtanfam electricity_tsp if minority==1 , cluster(locationid)
eststo conflict2
reg service state male age urban edu_alt income_alt wunhtanfam electricity_tsp if minority==0 , cluster(locationid)
eststo conflict3

esttab conflict1 conflict2 conflict3 using conflictservice.tex, replace b(%12.2f) ///
	se title(Service experience in conflict-affected regions)  star(* 0.10 ** 0.05 *** 0.01) 




** Table A15
*******************************************
**** Instrumental variable analysis *******
*******************************************

ivreg natpride (service = govservice_location) if ethnicity>0, cluster(locationid)
eststo iv1
ivreg relativepride (service = govservice_location) if ethnicity>0, cluster(locationid)
eststo iv2
ivreg attachment (service = govservice_location) if ethnicity>0, cluster(locationid)
eststo iv3	
ivreg pen_myanmar (service = govservice_location) if ethnicity>0, cluster(locationid)
eststo iv4	

esttab iv1 iv2 iv3 iv4 using ivanalysis.tex, replace b(%12.2f) se title(Service experience instrumented by service accessibility)  star(* 0.10 ** 0.05 *** 0.01) 


*****************
**** Bamars *****
*****************

** Figure A3
hist natpride if ethnicity==0, percent w(.5) disc title("How proud are you to be a Myanmar citizen?") ///
	xlabel(0 "Not proud at all" 1 "Not proud" 2 "Somewhat proud" 3 "Very proud") ///
	xtitle(" ")

** Table A16
** Values manually entered, truncated. 
sum natpride attachment pen_myanmar if ethnicity==0



** Table A17

global DV_B natpride attachment pen_myanmar
mata: mata clear

est clear
foreach var in $DV_B {
reg `var' service if ethnicity==0, cluster(locationid)
eststo est_`var'
local estimates1 `estimates1' est_`var'
}                                                                                          

esttab `estimates1' using bamar.tex, replace b(%12.2f) se title(Service experience and ethnic majorities' attachment to the state)  star(* 0.10 ** 0.05 *** 0.01) 



	













